﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SettingsDialog.cs" company="YellowFish">
//   Copyright © YellowFish 2009
// </copyright>
// <summary>
//   Defines the SettingsDialog type.
// </summary>
// <author>
// Roman "4ux-nbIx" Novitsky
// </author>
// --------------------------------------------------------------------------------------------------------------------

namespace OneNoteNotify
{
  #region Imported Namespaces


  using System;
  using System.Windows.Forms;


  #endregion


  internal partial class SettingsDialog: Form
  {
    #region Constants and Fields


    private readonly PropertyGridSettingsWrapper _settings;


    #endregion


    #region Constructors and Destructors


    public SettingsDialog(Settings settings)
    {
      InitializeComponent();

      _settings = new PropertyGridSettingsWrapper(settings);
    }


    #endregion


    #region Properties


    public Settings Settings
    {
      get
      {
        return _settings.SourceSettings;
      }
    }


    #endregion


    #region Methods


    private void BtnMonitoringSettingsClick(object sender, EventArgs e)
    {
      var dialog = new MonitoringSettingsDialog(_settings.SourceSettings.MonitoringSettings);
      DialogResult result = dialog.ShowDialog();

      switch (result)
      {
        case DialogResult.OK:
          _settings.SourceSettings.MonitoringSettings = dialog.GetMonitoringSettings();
          break;
      }
    }


    private void BtnOKClick(object sender, EventArgs e)
    {
      DialogResult = DialogResult.OK;
      Close();
    }


    private void PropertyGrid1Click(object sender, EventArgs e)
    {
    }


    private void SettingsDialog_Load(object sender, EventArgs e)
    {
      _propertyGrid.SelectedObject = _settings;
    }


    #endregion
  }
}